package com.situ.stmall.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import com.situ.stmall.service.OrderService;

/**
 * 清理无效订单
 * @author bobzyh
 *
 */

@Component
public class CleanOrderInterceptor implements HandlerInterceptor{

	@Autowired
	private OrderService orderService;
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		// 清理无效订单
		orderService.clean();
		
		// 放行
		return true;
	}
}
